
class BaseController {
    private _messages: any;
    private _model: BaseModel;

    public constructor() {
        this._messages = {};
    }

    public registerFunc(key: any, callbackFunc: Function, callbackObj: any): void {
        this._messages[key] = [callbackFunc, callbackObj];
    }

    public applyFunc(key: any, ...param: any[]): any {
        var listen: any = this._messages[key];
        if (listen) {
            return listen[0].apply(listen[1], param);
        } else {
            console.debug("消息" + key + "不存在侦听");
            return null;
        }
    }

    public setModel(model:BaseModel):void {
        this._model = model;
    }
    public getModel():BaseModel {
        return this._model;
    }

    public getControllerModel(controllerD:number):BaseModel {
        return App.ControllerManager.getControllerModel(controllerD);
    }
    public applyControllerFunc(controllerKey:number, key:any, ...param:any[]):any {
        return App.ControllerManager.applyFunc.apply(App.ControllerManager, arguments);
    }
}